<template>
  <div id="jurisdictionlist"> 


          <el-table :data="list" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">

                <el-table-column label="时间"  align='center' width="200px">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.vice_leader_begin_time }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="帐号"  align='center' width="150">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.telphone }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="用户名"  align='center' width="200">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="所属团队"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.team_name }}{{ scope.row.team_telphone }}</span>
                    </template>
                </el-table-column>
                  <el-table-column label="新增统计"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span @click="tj_but(scope.row)">详情</span>
                    </template>
                </el-table-column>
                <el-table-column label="所属运营中心"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.center_name }}</span>
                    </template>
                </el-table-column>
                 
 
                 <el-table-column label="操作" align='center' width="200px" fixed="right">
                    <template slot-scope="scope">
                        <el-button size="mini"  type="primary"  plain @click="gm_but(scope.row)">{{ variable_name1 }}</el-button>
                         <el-button size="mini"  type="primary" plain @click="delect_but(scope.row)">删除</el-button>  
                    </template>
                </el-table-column>
  
            </el-table>  


         <!-- 添加果米 -->
           <el-dialog :title="'添加' + variable_name1" :visible.sync="add_gm_mtk"  width="400px">
            <div style="width:100%;"> 

              <el-form ref="form"   label-width="100px" style="width:100%;">
                
                <el-form-item label="选择类型">
                  <el-select  v-model="select_num" placeholder="请选择" >
                      <el-option  v-for="(item,index) in select_data" :key="index" :label="item.name" :value="item.id"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item :label="variable_name1 + '数量'">
                    <el-input v-model.number="price" placeholder="数量/请输入正数"></el-input>
                </el-form-item>                                   
            </el-form>

            <div style="text-align: center;width:50%;margin:auto;">
                <el-button type="primary" class="custom_color_button" style="width:80%;" @click="gm_but_qr">确认</el-button>
            </div>

            </div> 
        </el-dialog>

             <!-- 外连接 -->
        <el-dialog title="新增统计" :visible.sync="mtk1"  width="400px" class="iphone">
            <div class="iphone_box" style="width:100%;height:650px;padding: 10px;box-sizing: border-box;"> 

               <iframe :src="statistics_page" width="100%" height="100%" style="border: 0"></iframe>

            </div> 
        </el-dialog>

   </div>
</template>

<script>

export default {
   name: 'jurisdictionlist',
   props:{
      list:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
        add_gm_mtk:false,
        price:'',
        select_data:[{"id":1,"name":"增加"},{"id":2,"name":"减少"}],
        select_num:1,
        uid:'',
         mtk1:false,
        statistics_page:'',
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 253
      
  },
  mounted (){
     
  },
  methods: {
    
     gm_but(row){
          this.add_gm_mtk = true
          this.uid = row.uid
     },
     gm_but_qr(){
        
        if(Math.sign(this.price) != -1){
              
              this.post("/team/changeKmb", {
                    uid:this.uid ,
                    type:this.select_num,
                    price:this.price
              }).then(res => {

                    if(res.error_code == 0){
                      this.open1(res.result,'success')  //提示框
                      this.add_gm_mtk = false
                      this.$emit('up_list_fun')
                      this.select_num = 1
                      this.uid = ''
                      this.price = ''
                    }else {
                      this.open1(res.message,'warning')
                  }
              
                })

         }else{
                   this.open1('输入不能为负数','warning')
         }

     },
     delect_but(row){
          this.$confirm('是否删除, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {
            this.post("/goldbean/delViceLeader", {
                    uid:row.uid,
                }).then(res => {
                    if(res.error_code == 0){
                    this.open1(res.result,'success')  //提示框
                    this.$emit('up_list_fun')
                    }else {
                    this.open1(res.message,'warning')
                }

             })
        }).catch(() => {
                 
        });
     },
      tj_but(row){
           this.uid = row.uid
           this.statistics_page = ''
           this.post("/member/tokenForLookClient", {
                 uid:this.uid
	       }).then(res => {

              if(res.error_code == 0){
                    this.statistics_page = this.urlwlj + 'pages/user/index' + '?token=' + res.result + '&type=1'
                    this.mtk1 = true
              }else {
                  this.open1(res.message,'warning')
              }
       

            })

     },


  }
}
</script>


<style scoped>
</style>